package com.baidu.mapapi;

import android.content.Context;

public class BMapManager
{
  Mj a = null;
  private Context b = null;
  private boolean c = false;

  public BMapManager(Context paramContext)
  {
    this.b = paramContext;
  }

  public void destroy()
  {
    if (this.c)
      stop();
    this.c = false;
    if (this.a != null)
    {
      this.a.UnInitMapApiEngine();
      this.a = null;
    }
  }

  public MKLocationManager getLocationManager()
  {
    return Mj.b;
  }

  public boolean init(String paramString, MKGeneralListener paramMKGeneralListener)
  {
    int i;
    this.c = false;
    if (this.a == null)
    {
      this.a = new Mj(this, this.b);
      if (!(this.a.a(paramString, paramMKGeneralListener)))
      {
        this.a = null;
        i = 0;
      }
    }
    while (true)
    {
      while (true)
      {
        return i;
        if (!(Mj.b.a(this)))
          break;
        Mj.b.b();
        i = 1;
      }
      i = 0;
    }
  }

  public boolean start()
  {
    int i;
    if (this.c)
      i = 1;
    while (true)
    {
      while (true)
      {
        while (true)
        {
          return i;
          if (this.a != null)
            break;
          i = 0;
        }
        if (!(this.a.a()))
          break;
        this.c = true;
        i = 1;
      }
      i = 0;
    }
  }

  public boolean stop()
  {
    int i;
    if (!(this.c))
      i = 1;
    while (true)
    {
      while (true)
      {
        while (true)
        {
          return i;
          if (this.a != null)
            break;
          i = 0;
        }
        if (!(this.a.b()))
          break;
        this.c = false;
        i = 1;
      }
      i = 0;
    }
  }
}